const db = require("../../middleware/db");
const Sequelize = require("sequelize");

module.exports = sys_form_field = db.define("sys_form_field", {
  form_id: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    allowNull: false,
    defaultValue: "0",
    comment: "表单id",
  },
  model_field_id: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    allowNull: false,
    defaultValue: "0",
    comment: "字段id",
  },
  model_field_name: {
    type: Sequelize.STRING(50),
    allowNull: false,
    defaultValue: "",
    comment: "字段名称",
  },
  control: {
    type: Sequelize.TEXT,
    allowNull: false,
    defaultValue: "{}",
    comment: "控件",
  },
  is_show_edit: {
    type: Sequelize.INTEGER(1),
    allowNull: false,
    defaultValue: 0,
    comment: "是否显示在编辑界面",
  },

  is_edit_disable: {
    type: Sequelize.INTEGER(1),
    allowNull: false,
    defaultValue: 0,
    comment: "编辑界面是否禁用",
  },
  is_show_list: {
    type: Sequelize.INTEGER(1),
    allowNull: false,
    defaultValue: 0,
    comment: "是否显示在列表",
  },

  is_show_seach: {
    type: Sequelize.INTEGER(1),
    allowNull: false,
    defaultValue: 0,
    comment: "是否显示在搜索",
  },
  sort: {
    type: Sequelize.INTEGER(11).UNSIGNED,
    allowNull: false,
    defaultValue: "0",
    comment: "排序",
  },
});

// sys_form_field.sync({ force: true });
